#ifndef __QCONTROL_UTILS_INCLUDE__
#define __QCONTROL_UTILS_INCLUDE__
#include "qwt_knob.h"

#include <QComboBox>
#include <QCheckBox>
#include <QDoubleSpinBox>

void SetManualValue(QwtKnob* pKnob, double value);
void SetManualValue(QComboBox* pCombo, int value);
void SetManualValue(QComboBox* pCombo, QVariant userData);
void SetManualValue(QCheckBox* checkbox, bool checked);
void SetManualValue(QDoubleSpinBox* pSpin, double value);

void SetWidgetsEnable(QWidget* parent, const QRegExp &regExp, bool enable);
void connectDefaultSlot(QWidget* pParent, QObject* manager);

double ToDegreesDouble(double degrees);


inline double UnitsConvertMetersX10ToNauticalMiles_double(int metersX10)
{
    return ((double)metersX10 / 18520.0);
}

inline int UnitsConvertNauticalMilesToMeters_double(double nauticalMiles)
{
    return (int)((double)nauticalMiles * 1852.0);
}

struct RadarRange {
    int meters;
    int actual_meters;
    const char *name;
    const char *range1;
    const char *range2;
    const char *range3;
    int ringSize;
    double ringm;
    const char* ringName;
};
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))

const RadarRange* getRadarRangeArray(int uints);
int getRadarRangeSize(int units);

const RadarRange* convertMetersToRadarAllowedValue(int setup_m, int& idx);

#endif
